<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
        /* 
            需求：提供一个方法，输入日期可以返回季度
            let date = new Date('2022-04-17')
            let yearQuarter = getQuarter(date)
            console.log(yearQuarter)  //2022-2
         */

         
       /*  let year = prompt("输入年份")
        let date = new Date(year)
        console.log(date.getMonth)
        if(date.getMonth>=1&&date.getMonth<=3){
            alert("第一季度")
        } */

        
        let date1= new Date(prompt("输入日期"))
        // console.log(date1.getMonth()+1)
        if((date1.getMonth()+1)>=1&&(date1.getMonth()+1)<=3){
            alert("第一季度");
        }else if((date1.getMonth()+1)>=4&&(date1.getMonth()+1)<=6){
            alert("第二季度")
        }else if((date1.getMonth()+1)>=7&&(date1.getMonth()+1)<=9){
            alert("第三季度")
        }else if((date1.getMonth()+1)>=9&&(date1.getMonth()+1)<=12){
            alert("第四季度")
        }else{
            alert("输入错误")
        }
  

        
    </script>
</head>
<body>
    
</body>
</html>